<template>
  <div>
    <!-- Hero Section -->
    <section class="hero-section bg-primary text-white py-5 animate__animated animate__fadeIn">
      <div class="container py-5">
        <div class="row align-items-center">
          <div class="col-lg-6 animate__animated animate__fadeInLeft">
            <h1 class="display-4 fw-bold mb-4">
              探索世界之美<br />开启精彩旅程
            </h1>
            <p class="lead mb-4 animate__animated animate__fadeIn animate__delay-1s">
              发现全球最佳旅游目的地，获取专业旅行建议，预订优质旅游产品，
              让每一次出行都成为难忘回忆。
            </p>
            <div class="d-flex flex-wrap gap-2 animate__animated animate__fadeInUp animate__delay-2s">
              <button class="btn btn-warning btn-lg px-4 py-2">
                <i class="bi bi-search me-2"></i>搜索目的地
              </button>
              <button class="btn btn-outline-light btn-lg px-4 py-2">
                <i class="bi bi-play-circle me-2"></i>观看视频
              </button>
            </div>
          </div>
          <div class="col-lg-6 mt-5 mt-lg-0 animate__animated animate__fadeInRight">
            <div class="rounded bg-light floating-element" style="height: 350px"></div>
          </div>
        </div>
      </div>
    </section>

    <!-- Search Form -->
    <section class="py-4 bg-light animate__animated animate__fadeInUp">
      <div class="container">
        <div class="card border-0 shadow floating-element-2">
          <div class="card-body p-4">
            <form class="row g-3">
              <div class="col-md-3">
                <label class="form-label">目的地</label>
                <input
                  type="text"
                  class="form-control"
                  placeholder="想去哪里？"
                />
              </div>
              <div class="col-md-2">
                <label class="form-label">出发日期</label>
                <input type="date" class="form-control" />
              </div>
              <div class="col-md-2">
                <label class="form-label">返回日期</label>
                <input type="date" class="form-control" />
              </div>
              <div class="col-md-2">
                <label class="form-label">游客人数</label>
                <select class="form-select">
                  <option selected>1人</option>
                  <option>2人</option>
                  <option>3人</option>
                  <option>4人以上</option>
                </select>
              </div>
              <div class="col-md-3 d-flex align-items-end">
                <button class="btn btn-primary w-100 py-2">
                  <i class="bi bi-search me-2"></i>搜索
                </button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </section>

    <!-- Featured Destinations -->
    <section class="py-5">
      <div class="container">
        <div class="row mb-4 animate__animated animate__fadeIn">
          <div class="col-md-8">
            <h2 class="fw-bold">热门目的地</h2>
            <p class="text-muted">探索全球最受欢迎的旅游胜地</p>
          </div>
          <div class="col-md-4 text-md-end">
            <NuxtLink to="/destinations" class="btn btn-outline-primary">
              查看全部 <i class="bi bi-arrow-right ms-2"></i>
            </NuxtLink>
          </div>
        </div>

        <div class="row">
          <div
            v-for="(destination, index) in destinations"
            :key="index"
            class="col-lg-3 col-md-6 mb-4 animate__animated animate__fadeInUp"
            :style="{ 'animation-delay': (index * 0.1) + 's' }"
          >
            <div class="card h-100 border-0 shadow-sm floating-element">
              <div class="bg-light" style="height: 200px"></div>
              <div class="card-body">
                <div class="d-flex justify-content-between align-items-start">
                  <h5 class="card-title">{{ destination.name }}</h5>
                  <span class="badge bg-primary"
                    >{{ destination.rating }} <i class="bi bi-star-fill"></i
                  ></span>
                </div>
                <p class="card-text text-muted small">
                  <i class="bi bi-geo-alt me-1"></i> {{ destination.location }}
                </p>
                <div class="d-flex justify-content-between align-items-center">
                  <span class="fw-bold text-primary"
                    >￥{{ destination.price }}</span
                  >
                  <NuxtLink
                    :to="'/destinations/' + index"
                    class="btn btn-sm btn-outline-primary"
                  >
                    查看详情
                  </NuxtLink>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Special Offers -->
    <section class="py-5 bg-light">
      <div class="container">
        <div class="row mb-4 animate__animated animate__fadeIn">
          <div class="col-md-8">
            <h2 class="fw-bold">特价优惠</h2>
            <p class="text-muted">限时特惠，不容错过</p>
          </div>
          <div class="col-md-4 text-md-end">
            <NuxtLink to="/tours" class="btn btn-outline-primary">
              查看更多 <i class="bi bi-arrow-right ms-2"></i>
            </NuxtLink>
          </div>
        </div>

        <div class="row">
          <div
            v-for="(offer, index) in offers"
            :key="index"
            class="col-lg-4 col-md-6 mb-4 animate__animated animate__fadeInUp"
            :style="{ 'animation-delay': (index * 0.1) + 's' }"
          >
            <div class="card border-0 shadow-sm floating-element-2">
              <div class="position-relative">
                <div class="bg-light" style="height: 200px"></div>
                <span
                  class="position-absolute top-0 start-0 m-3 badge bg-danger"
                >
                  {{ offer.discount }}% OFF
                </span>
              </div>
              <div class="card-body">
                <h5 class="card-title">{{ offer.title }}</h5>
                <p class="card-text">{{ offer.description }}</p>
                <div class="d-flex justify-content-between align-items-center">
                  <div>
                    <span class="text-decoration-line-through text-muted me-2"
                      >￥{{ offer.originalPrice }}</span
                    >
                    <span class="fw-bold text-primary"
                      >￥{{ offer.discountPrice }}</span
                    >
                  </div>
                  <NuxtLink to="/tours" class="btn btn-sm btn-primary"
                    >立即预订</NuxtLink
                  >
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Why Choose Us -->
    <section class="py-5">
      <div class="container">
        <div class="text-center mb-5 animate__animated animate__fadeIn">
          <h2 class="fw-bold">为什么选择我们</h2>
          <p class="text-muted">专业服务，让您的旅程更轻松愉快</p>
        </div>

        <div class="row">
          <div
            v-for="(service, index) in services"
            :key="index"
            class="col-lg-3 col-md-6 mb-4 animate__animated animate__fadeInUp"
            :style="{ 'animation-delay': (index * 0.1) + 's' }"
          >
            <div class="text-center floating-element">
              <div
                class="rounded-circle bg-primary d-inline-flex align-items-center justify-content-center mx-auto mb-3"
                style="width: 80px; height: 80px"
              >
                <i :class="service.icon + ' text-white fs-3'"></i>
              </div>
              <h5 class="fw-bold">{{ service.title }}</h5>
              <p class="text-muted">{{ service.description }}</p>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Testimonials -->
    <section class="py-5 bg-light">
      <div class="container">
        <div class="text-center mb-5 animate__animated animate__fadeIn">
          <h2 class="fw-bold">客户评价</h2>
          <p class="text-muted">听听我们的客户怎么说</p>
        </div>

        <div class="row">
          <div class="col-12">
            <div
              id="testimonialCarousel"
              class="carousel slide"
              data-bs-ride="carousel"
            >
              <div class="carousel-inner">
                <div
                  v-for="(testimonial, index) in testimonials"
                  :key="index"
                  :class="['carousel-item', { active: index === 0 }]"
                >
                  <div class="row justify-content-center">
                    <div class="col-lg-8">
                      <div class="card border-0 text-center floating-element">
                        <div class="card-body p-5">
                          <div class="mb-4">
                            <i class="bi bi-quote text-primary fs-1"></i>
                          </div>
                          <p class="lead">{{ testimonial.text }}</p>
                          <div class="mt-4">
                            <div
                              class="bg-light rounded-circle mx-auto mb-3"
                              style="width: 80px; height: 80px"
                            ></div>
                            <h5 class="fw-bold mb-1">{{ testimonial.name }}</h5>
                            <p class="text-muted">{{ testimonial.location }}</p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <button
                class="carousel-control-prev"
                type="button"
                data-bs-target="#testimonialCarousel"
                data-bs-slide="prev"
              >
                <span
                  class="carousel-control-prev-icon"
                  aria-hidden="true"
                ></span>
                <span class="visually-hidden">Previous</span>
              </button>
              <button
                class="carousel-control-next"
                type="button"
                data-bs-target="#testimonialCarousel"
                data-bs-slide="next"
              >
                <span
                  class="carousel-control-next-icon"
                  aria-hidden="true"
                ></span>
                <span class="visually-hidden">Next</span>
              </button>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- Newsletter -->
    <section class="py-5">
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-lg-8 animate__animated animate__fadeInUp">
            <div class="card border-0 shadow floating-element-2">
              <div class="card-body p-5 text-center">
                <h3 class="fw-bold mb-3">订阅我们的旅游资讯</h3>
                <p class="text-muted mb-4">
                  获取最新的旅游优惠、目的地推荐和旅行小贴士
                </p>
                <form class="row g-3 justify-content-center">
                  <div class="col-md-8">
                    <input
                      type="email"
                      class="form-control form-control-lg"
                      placeholder="请输入您的邮箱地址"
                    />
                  </div>
                  <div class="col-md-4">
                    <button class="btn btn-primary btn-lg w-100" type="submit">
                      立即订阅
                    </button>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

<script setup lang="ts">
// 模拟数据
const destinations = [
  { name: "巴黎浪漫之旅", location: "法国", rating: 4.8, price: 8999 },
  { name: "东京文化体验", location: "日本", rating: 4.7, price: 7899 },
  { name: "纽约都市风情", location: "美国", rating: 4.6, price: 12800 },
  { name: "巴厘岛度假", location: "印度尼西亚", rating: 4.9, price: 6999 },
];

const offers = [
  {
    title: "地中海邮轮之旅",
    description: "7天6晚豪华邮轮体验",
    originalPrice: 15999,
    discountPrice: 11999,
    discount: 25,
  },
  {
    title: "瑞士雪山探险",
    description: "5天4晚滑雪度假套餐",
    originalPrice: 12999,
    discountPrice: 9999,
    discount: 23,
  },
  {
    title: "马尔代夫蜜月",
    description: "奢华水上别墅体验",
    originalPrice: 19999,
    discountPrice: 14999,
    discount: 25,
  },
];

const services = [
  {
    icon: "bi bi-shield-check",
    title: "安全保障",
    description: "全程保险保障，让您安心出行",
  },
  {
    icon: "bi bi-headset",
    title: "24小时客服",
    description: "专业客服团队随时为您服务",
  },
  {
    icon: "bi bi-currency-dollar",
    title: "价格保证",
    description: "全网比价，保证最优价格",
  },
  { icon: "bi bi-star", title: "精选体验", description: "精心挑选，品质保证" },
];

const testimonials = [
  {
    text: "通过这个平台预订的巴厘岛之旅非常棒！服务专业，行程安排合理，强烈推荐给想要高品质旅游的朋友。",
    name: "张女士",
    location: "北京",
  },
  {
    text: "第一次使用这家旅游网站，体验超出预期。客服响应迅速，行程细节考虑周到，下次还会再来的！",
    name: "李先生",
    location: "上海",
  },
  {
    text: "欧洲十日游安排得非常好，导游专业，住宿交通都很舒适。性价比很高的一次旅行体验。",
    name: "王小姐",
    location: "广州",
  },
];
</script>

<style scoped>
.hero-section {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="30" r="1" fill="white" opacity="0.3"/><circle cx="80" cy="70" r="1" fill="white" opacity="0.3"/><circle cx="50" cy="10" r="1" fill="white" opacity="0.3"/><circle cx="10" cy="90" r="1" fill="white" opacity="0.3"/><circle cx="90" cy="20" r="1" fill="white" opacity="0.3"/></svg>') repeat;
  animation: stars 30s linear infinite;
}

@keyframes stars {
  from { transform: translateY(0); }
  to { transform: translateY(-100px); }
}

.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.rounded-circle {
  width: 80px;
  height: 80px;
}

.floating-element {
  animation: float 5s ease-in-out infinite;
}

.floating-element-2 {
  animation: float 7s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

@keyframes floatReverse {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-15px);
  }
  100% {
    transform: translateY(0px);
  }
}

.animate__animated.animate__fadeInUp {
  --animate-duration: 0.8s;
}

.animate__animated.animate__fadeInLeft {
  --animate-duration: 0.8s;
}

.animate__animated.animate__fadeInRight {
  --animate-duration: 0.8s;
}
</style>
